
from django.shortcuts import render,HttpResponse
from Models.models import Book
from django.core import serializers

class queryColumn():
    def index(request):
        # __gt 大于号 ，= 号后面为数字。.filter(price__gt=200)
        # __lt 小于，=号后面为数字。.filter(price__lt=300)
        books = Book.objects.filter(price__in=[200])
        # print(books[0]["price"],type(books))
        return HttpResponse(serializers.serialize('json', list(books), fields=('id','price')))
